.\" Someone tell emacs that this is an -*- nroff -*- source file.
.\" Copyright 1997, 1998, 1999 Guy Maor.
.\" Adduser and this manpage are copyright 1995 by Ted Hajek,
.\" With much borrowing from the original adduser copyright 1994 by
.\" Ian Murdock.
.\" 
.\" This is free software; see the GNU General Public License version
.\" 2 or later for copying conditions.  There is NO warranty.
.TH DELUSER 8 "Version VERSION" "Debian GNU/Linux"
.SH NAME
deluser, delgroup \- remove a user or group from the system
.SH SYNOPSIS
.BR deluser " [options] [\-\-force] [\-\-remove-home] [\-\-remove-all-files] [\-\-backup] [\-\-backup-to DIR] user"
.PP
.BR deluser " \-\-group [options] group"
.br
.BR delgroup " [options] [\-\-only-if-empty] group"
.PP
.BR deluser " [options] user group"
.SS COMMON OPTIONS
.br
[\-\-quiet] [\-\-system] [\-\-help] [\-\-version] [\-\-conf FILE]
.SH DESCRIPTION
.PP
.BR deluser " and " delgroup
remove users and groups from the system according to command line options
and configuration information in
.IR /etc/deluser.conf 
and
.IR /etc/adduser.conf .
They are friendlier front ends to the
.BR userdel " and " groupdel
programs, removing the home directory as option or even all files on the system
owned by the user to be removed, running a custom script, and other features.
.BR deluser " and " delgroup
can be run in one of three modes:
.SS "Remove a normal user"
If called with one non-option argument and without the
.BR \-\-group " option, " deluser
will remove a normal user.

By default,
.B deluser
will remove the user without removing the home directory, the mail spool  or
any other files on the system owned by the user. Removing the home directory
and mail spool can be achieved using the
.B \-\-remove-home
option. 

The 
.B \-\-remove-all-files
option removes all files on the system owned by the user. Note that if
you activate both options
.B \-\-remove-home
will have no effect because all files including the home directory and mail
spool are already covered by the
.B \-\-remove-all-files
option.

If you want to backup all files before deleting them you can activate the
.B \-\-backup
option which will create a file username.tar(.gz|.bz2) in the
directory specified by the
.B \-\-backup-to
option (defaulting to the current working directory). Both the remove
and backup options can also be activated for default in the configuration
file /etc/deluser.conf. See
.B deluser.conf(5)
for details.

If you want to remove the root account (uid 0), then use the 
.B \-\-force 
parameter; this may prevent to remove the root user by accident.

If the file
.B /usr/local/sbin/deluser.local
exists, it will be executed after the user account has been removed
in order to do any local cleanup. The arguments passed to
.B deluser.local
are:
.br
username uid gid home-directory

.SS "Remove a group"
If 
.BR deluser " is called with the " \-\-group " option, or " delgroup
is called, a group will be removed.

Warning: The primary group of an existing user cannot be removed.

If the option
.B \-\-only-if-empty
is given, the group won't be removed if it has any members left.

.SS "Remove a user from a specific group"
If called with two non-option arguments,
.B deluser
will remove a user from a specific group.
.SH OPTIONS
.TP
.B \-\-conf FILE
Use FILE instead of the default files
.IR /etc/deluser.conf
and
.IR /etc/adduser.conf
.TP
.B \-\-group
Remove a group. This is the default action if the program is invoked
as
.IR delgroup .
.TP
.B \-\-help
Display brief instructions.
.TP
.B \-\-quiet
Suppress progress messages.
.TP
.B \-\-system
Only delete if user/group is a system user/group. This avoids
accidentally deleting non-system users/groups. Additionally, if the
user does not exist, no error value is returned. This option is mainly
for use in Debian package maintainer scripts.
.TP
.B \-\-only-if-empty 
Only remove if no members are left.
.TP
.B \-\-backup
Backup all files contained in the userhome and the mailspool-file to a file named
/$user.tar.bz2 or /$user.tar.gz.
.TP
.B \-\-backup-to
Place the backup files not in / but in the directory specified by this parameter. This implicitly sets --backup also.
.TP
.B \-\-remove-home
Remove the home directory of the user and its mailspool. If \-\-backup is specified,
the files are deleted after having performed the backup.
.TP
.B \-\-remove-all-files
Remove all files from the system owned by this user. Note: \-\-remove-home does
not have an effect any more. If \-\-backup is specified, the files are deleted after
having performed the backup.
.TP
.B \-\-version
Display version and copyright information.
.SH "RETURN VALUE"
.TP
.B 0
The action was successfully executed.
.TP
.B 1
The user to delete was not a system account. No action was performed.
.TP
.B 2
There is no such user. No action was performed.
.TP
.B 3
There is no such group. No action was performed.
.TP
.B 4
Internal error. No action was performed.
.TP
.B 5
The group to delete is not empty. No action was performed.
.TP
.B 6
The user does not belong to the specified group. No action was performed.
.TP
.B 7
You cannot remove a user from its primary group. No action was performed.
.TP
.B 8
The required perl-package 'perl modules' is not installed. This package is required to perform the requested actions. No action was performed.
.TP
.B 9
For removing the root account the parameter "--force" is required. No action was performed.

.SH FILES
.IR /etc/deluser.conf
Default configuration file for deluser and delgroup
.TP
.IR /usr/local/sbin/deluser.local
Optional custom add-ons.

.SH "SEE ALSO"
.BR adduser (8),
.BR deluser.conf (5),
.BR groupdel (8),
.BR userdel (8) 

.SH COPYRIGHT
Copyright (C) 2000 Roland Bauerschmidt. Modifications (C) 2004
Marc Haber and Joerg Hoh.
This manpage and the deluser program are based on adduser which is:
.br
Copyright (C) 1997, 1998, 1999 Guy Maor.
.br
Copyright (C) 1995 Ted Hajek, with a great deal borrowed from the original
Debian 
.B adduser
.br
Copyright (C) 1994 Ian Murdock.
.B deluser
is free software; see the GNU General Public Licence version 2 or
later for copying conditions.  There is
.I no
warranty.
